﻿<!-- Copyright (c) Microsoft Corporation. All rights reserved -->
<sap:ActivityDesigner x:Class="TfsBuildExtensions.Activities.Azure.AzureOperationDesigner"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:sap="clr-namespace:System.Activities.Presentation;assembly=System.Activities.Presentation"
    xmlns:sapv="clr-namespace:System.Activities.Presentation.View;assembly=System.Activities.Presentation">
  <sap:ActivityDesigner.Resources>
    <DataTemplate x:Key="Expanded">
      <StackPanel>
      </StackPanel>
    </DataTemplate>
    <DataTemplate x:Key="Collapsed">
        <DockPanel>
            <Border BorderBrush="LightGray" BorderThickness="0" Height="50" HorizontalAlignment="Stretch" Margin="5,5,0,0" Name="border1" VerticalAlignment="Top" DockPanel.Dock="Top">
                <StackPanel>
                    <TextBlock FontWeight="Bold">Azure Operation</TextBlock>
                    <sap:WorkflowItemPresenter Margin="0,10,0,0" AllowDrop="True" Item="{Binding Path=ModelItem.Operation, Mode=TwoWay}"
                            HintText="Drop an activity here" HorizontalAlignment="Center" />
                </StackPanel>
            </Border>
            <Grid Margin="0, 5, 0, 0" >
                <Grid.RowDefinitions>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Border BorderBrush="LightGray" BorderThickness="1" Name="border2" Margin="10" Grid.Column="0">
                    <StackPanel Margin="5,5,5,5">
                            <TextBlock FontWeight="Bold">Success</TextBlock>
                        <sap:WorkflowItemPresenter AllowDrop="True" Item="{Binding Path=ModelItem.Success, Mode=TwoWay}"
                                HintText="Drop an activity here" />
                    </StackPanel>
                </Border>
                <Border BorderBrush="LightGray" BorderThickness="1" Name="border3" Margin="10" Grid.Column="1">
                    <StackPanel Margin="5,5,5,5">
                            <TextBlock FontWeight="Bold">Failure</TextBlock>
                        <sap:WorkflowItemPresenter AllowDrop="True" Item="{Binding Path=ModelItem.Failure, Mode=TwoWay}"
                                HintText="Drop an activity here" />
                    </StackPanel>
                </Border>
            </Grid>
        </DockPanel>
    </DataTemplate>
    <Style x:Key="ExpandOrCollapsedStyle" TargetType="{x:Type ContentPresenter}">
      <Setter Property="ContentTemplate" Value="{DynamicResource Collapsed}"/>
      <Style.Triggers>
        <DataTrigger Binding="{Binding Path=ShowExpanded}" Value="true">
          <Setter Property="ContentTemplate" Value="{DynamicResource Expanded}"/>
        </DataTrigger>
      </Style.Triggers>
    </Style>
  </sap:ActivityDesigner.Resources>
  <Grid>
    <ContentPresenter Style="{DynamicResource ExpandOrCollapsedStyle}" Content="{Binding}" />
  </Grid>
</sap:ActivityDesigner>
